import 'package:aio/aio.dart';
import 'package:flutter/material.dart';
import 'package:app/generated/app_strings.dart';
import 'package:app/src/presenter/review_presenter.dart';
import 'package:app/src/ui/app_ui.dart';
import 'package:app/src/ui/route/works/public/items/ui_base.dart';
import 'package:app/src/ui/route/works/public/items/ui_node_list.dart';
import 'package:app/src/ui/route/works/public/review_details_ui.dart';
import 'package:app/src/ui/route/works/public/review_submitted.dart';

import '../../../../http/bean/worksdo/material_requisition_bean.dart';
import '../../../../http/bean/ywx_limit.dart';
import '../../worksdo/type16_material_requisition/public/items/ui_attachment.dart';

///采购合同审核详情,跳转到 查看附件
class PurcontractAuditDetailsFujianRoute extends StatefulWidget {
  YwxItem item;
  List<String>? data;

  PurcontractAuditDetailsFujianRoute(this.item, this.data);

  @override
  _State createState() => _State();
}

class _State extends State<PurcontractAuditDetailsFujianRoute> {
  _Presenter presenter = _Presenter();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return ReviewDetailsUi.build(context, presenter, _body);
  }

  Widget _body(BuildContext context) {
    if (StringUtils.isEmpty(widget.data)) {
      return AppUi.getEmptyView();
    }

    List<Widget> children = [];
    // title: AppStrings.of(context).hetongfujian //合同附件
    children.add(UiAttachment.build(
      context,
      widget.data,
      isShowEmpty: true,
    )); //附件
    return Column(
      children: [
        Expanded(child: UiBase.listView(context, children)),
        Visibility(
            child: ReviewSubmittedStateful(
              presenter?.mDatas,
              hasBack: true,
              onlyBack: true,
              hasEnd: false,
              hasAuditOpinion: false,
            ),
            visible: true)
      ],
    );
  }
}

class _Presenter extends ReviewPresenter {}
